Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(connector): Add a dummy trait WithOptions #14175

Merged
merged 6 commits into from
Dec 27, 2023

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented Dec 25, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

To enforce children types are also marked with WithOptions.

As proposed by Bugen here #13654 (comment)

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@xxchan xxchan force-pushed the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch from cbda545 to a4945e4 Compare December 25, 2023 07:37
@xxchan xxchan changed the base branch from main to 12-25-refactor_source_remove_unnecessary_Box_for_NexmarkProperties December 25, 2023 07:37
@xxchan xxchan force-pushed the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch from 5106232 to 1a654b3 Compare December 25, 2023 07:50
@xxchan xxchan marked this pull request as ready for review December 25, 2023 07:53
@xxchan xxchan requested a review from a team as a code owner December 25, 2023 07:53
Comment on lines +17 to +33
/// Marker trait for `WITH` options. Only for `#[derive(WithOptions)]`, should not be used manually.
///
/// This is used to ensure the `WITH` options types have reasonable structure.
///
/// TODO: add this bound for sink. There's a `SourceProperties` trait for sources, but no similar
/// things for sinks.
pub trait WithOptions {
#[doc(hidden)]
#[inline(always)]
fn assert_receiver_is_with_options(&self) {}
}

// Currently CDC properties are handled specially.
// - It simply passes HashMap to Java DBZ.
// - It's not handled by serde.
// - It contains fields other than WITH options.
// TODO: remove the workaround here. And also use #[derive] for it.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlight TODOs

Comment on lines +51 to +57
///
/// Note: here we assumes the struct is parsed by `serde`. If it's not the case,
/// the generated `yaml` might be inconsistent with the actual parsing logic.
/// TODO: improve the test to check whether serde is used.
///
/// - For sources, the parsing logic is in `TryFromHashMap`.
/// - For sinks, the parsing logic is in `TryFrom<SinkParam>`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlight Note

@xxchan xxchan force-pushed the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch 3 times, most recently from c3cc640 to 94bc3a2 Compare December 25, 2023 08:46
@xxchan xxchan changed the base branch from 12-25-refactor_source_remove_unnecessary_Box_for_NexmarkProperties to 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract December 25, 2023 08:46
@xxchan xxchan force-pushed the 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract branch from d6e8b64 to 1ff6db4 Compare December 25, 2023 12:13
@xxchan xxchan force-pushed the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch 2 times, most recently from 307f0da to 5bb84dd Compare December 25, 2023 12:35
@xxchan xxchan requested a review from BugenZhao December 25, 2023 12:43
Copy link
Member

@BugenZhao BugenZhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COOL

@xxchan xxchan force-pushed the 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract branch from 71d2b0f to ecba13b Compare December 26, 2023 05:10
@xxchan xxchan force-pushed the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch from 9af8ff0 to da8f4e4 Compare December 26, 2023 05:10
@xxchan xxchan force-pushed the 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract branch from ecba13b to e44b49f Compare December 27, 2023 03:14
@xxchan xxchan force-pushed the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch from da8f4e4 to 6173db2 Compare December 27, 2023 03:14
Base automatically changed from 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract to main December 27, 2023 15:04
@xxchan xxchan force-pushed the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch from 6173db2 to e2f5a96 Compare December 27, 2023 15:30
@xxchan xxchan enabled auto-merge December 27, 2023 15:33
@xxchan xxchan added this pull request to the merge queue Dec 27, 2023
Merged via the queue into main with commit 9b08e26 Dec 27, 2023
28 of 29 checks passed
@xxchan xxchan deleted the 12-25-refactor_connector_Add_a_dummy_trait_WithOptions_ branch December 27, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants